<template>
  <el-row class="panel-group">
    <el-row :gutter="40">
      <!--        <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
                  <div class="card-panel" @click="handleSetLineChartData('newVisitis')">
                      <div class="card-panel-icon-wrapper icon-people">
                          <svg-icon icon-class="peoples" class-name="card-panel-icon"/>
                      </div>
                      <div class="card-panel-description">
                          <div class="card-panel-text">
                              访客
                          </div>
                          <count-to :start-val="0" :end-val="102400" :duration="2600" class="card-panel-num"/>
                      </div>
                  </div>
              </el-col>
              <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
                  <div class="card-panel" @click="handleSetLineChartData('messages')">
                      <div class="card-panel-icon-wrapper icon-message">
                          <svg-icon icon-class="message" class-name="card-panel-icon"/>
                      </div>
                      <div class="card-panel-description">
                          <div class="card-panel-text">
                              消息
                          </div>
                          <count-to :start-val="0" :end-val="81212" :duration="3000" class="card-panel-num"/>
                      </div>
                  </div>
              </el-col>
              <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
                  <div class="card-panel" @click="handleSetLineChartData('purchases')">
                      <div class="card-panel-icon-wrapper icon-money">
                          <svg-icon icon-class="money" class-name="card-panel-icon"/>
                      </div>
                      <div class="card-panel-description">
                          <div class="card-panel-text">
                              金额
                          </div>
                          <count-to :start-val="0" :end-val="9280" :duration="3200" class="card-panel-num"/>
                      </div>
                  </div>
              </el-col>
              <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
                  <div class="card-panel" @click="handleSetLineChartData('shoppings')">
                      <div class="card-panel-icon-wrapper icon-shopping">
                          <svg-icon icon-class="shopping" class-name="card-panel-icon"/>
                      </div>
                      <div class="card-panel-description">
                          <div class="card-panel-text">
                              订单
                          </div>
                          <count-to :start-val="0" :end-val="13600" :duration="3600" class="card-panel-num"/>
                      </div>
                  </div>
              </el-col>-->

      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-message">
            <svg-icon icon-class="icon" class-name="card-panel-icon"/>
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">
              已发放的积分
            </div>
            <count-to :start-val="0" :end-val="systemBoardView.totalScore" :duration="2600" class="card-panel-num"/>
          </div>
        </div>
      </el-col>

      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-people">
            <svg-icon icon-class="icon" class-name="card-panel-icon"/>
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">
              待使用的积分
            </div>
            <count-to :start-val="0" :end-val="systemBoardView.totalResidueScore" :duration="2600"
                      class="card-panel-num"/>
          </div>
        </div>
      </el-col>

      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-message">
            <el-icon class="el-icon-goods card-panel-icon"/>
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">
              待领取的物品
            </div>
            <count-to :start-val="0" :end-val="systemBoardView.waitGoodsCount" :duration="2600" class="card-panel-num"/>
          </div>
        </div>
      </el-col>

      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-message">
            <svg-icon icon-class="peoples" class-name="card-panel-icon"/>
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">
              待审核的居民
            </div>
            <count-to :start-val="0" :end-val="systemBoardView.auditUserCount" :duration="2600" class="card-panel-num"/>
          </div>
        </div>
      </el-col>

      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-message">
            <svg-icon icon-class="money" class-name="card-panel-icon"/>
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">
              待审核的活动
            </div>
            <count-to :start-val="0" :end-val="systemBoardView.auditActivityCount" :duration="2600"
                      class="card-panel-num"/>
          </div>
        </div>
      </el-col>

    </el-row>
    <el-row :gutter="40">

      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-people">
            <el-icon class="el-icon-bank-card card-panel-icon"/>
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">
              待使用的券
            </div>
            <count-to :start-val="0" :end-val="systemBoardView.waitCouponCount" :duration="2600" class="card-panel-num"/>
          </div>
        </div>
      </el-col>

      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-money">
            <el-icon class="el-icon-bank-card card-panel-icon"/>
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">
              已核销券
            </div>
            <count-to :start-val="0" :end-val="systemBoardView.useCouponSum" :duration="2600" class="card-panel-num"/>
          </div>
        </div>
      </el-col>

      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-message">
            <el-icon class="el-icon-bank-card card-panel-icon"/>
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">
              待审核的券
            </div>
            <count-to :start-val="0" :end-val="systemBoardView.auditCouponCount" :duration="2600" class="card-panel-num"/>
          </div>
        </div>
      </el-col>

    </el-row>
    <el-row :gutter="40">

      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-shopping">
            <svg-icon icon-class="guide" class-name="card-panel-icon"/>
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">
              已审核的商户
            </div>
            <count-to :start-val="0" :end-val="systemBoardView.auditedSellerCount" :duration="2600"
                      class="card-panel-num"/>
          </div>
        </div>
      </el-col>

      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-message">
            <svg-icon icon-class="guide" class-name="card-panel-icon"/>
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">
              待审核的商户
            </div>
            <count-to :start-val="0" :end-val="systemBoardView.auditSellerCount" :duration="2600" class="card-panel-num"/>
          </div>
        </div>
      </el-col>


    </el-row>

  </el-row>
</template>

<script>
import CountTo from 'vue-count-to'
import request from "@/utils/request";
import {getToken} from "@/utils/auth";

export default {
  components: {
    CountTo
  },
  data() {
    return {
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
      systemBoardView: {
        // 待使用的积分
        totalResidueScore: 0,
        // 总积分 = 待使用的积分 + 已使用积分汇总
        totalScore: 0,
        // 已发放的积分汇总
        increaseScore: 0,
        // 已使用积分汇总
        reduceScore: 0,
        // 已审核的居民
        auditedUserCount: 0,
        // 待审核的居民
        auditUserCount: 0,
        // 已使用的优惠券汇总
        usedCouponCount: 0,
        // 待使用的优惠券汇总
        waitCouponCount: 0,
        // 已核销的优惠券汇总
        verificationCouponCount: 0,
        // 发放数量汇总
        drawCouponSum: 0,
        // 使用数量汇总
        useCouponSum: 0,
        // 待审核的券汇总
        auditCouponCount: 0,
        // 已领取的物品数
        sendGoodsCount: 0,
        // 待领取的物品数
        waitGoodsCount: 0,
        // 已审核的活动数
        auditedActivityCount: 0,
        // 待审核的活动数
        auditActivityCount: 0,
        // 待审核的商户
        auditedSellerCount: 0,
        // 已审核的商户数
        auditSellerCount: 0,
      }
    };
  },
  created() {
    this.getSystemBoardView();
  },
  methods: {
    handleSetLineChartData(type) {
      this.$emit('handleSetLineChartData', type)
    },
    getSystemBoardView() {
      return request({
        url: '/organization/people/systemBoardView',
        method: 'get',
        params: this.queryScoreDayParams
      }).then(response => {
        this.systemBoardView = response.data;
      });
    }
  }
}
</script>

<style lang="scss" scoped>
.panel-group {
  margin-top: 10px;

  .card-panel-col {
    margin-bottom: 32px;
  }

  .card-panel {
    height: 108px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
    border-color: rgba(0, 0, 0, .05);

    &:hover {
      .card-panel-icon-wrapper {
        color: #fff;
      }

      .icon-people {
        background: #40c9c6;
      }

      .icon-message {
        background: #36a3f7;
      }

      .icon-money {
        background: #f4516c;
      }

      .icon-shopping {
        background: #34bfa3
      }

      .icon-user {
        background: #348abf
      }

      .icon-goods {
        background: #348abf
      }
    }

    .icon-people {
      color: #40c9c6;
    }

    .icon-message {
      color: #36a3f7;
    }

    .icon-money {
      color: #f4516c;
    }

    .icon-shopping {
      color: #34bfa3
    }

    .icon-user {
      color: #348abf
    }

    .icon-goods {
      color: #348abf
    }

    .card-panel-icon-wrapper {
      float: left;
      margin: 14px 0 0 14px;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
    }

    .card-panel-icon {
      float: left;
      font-size: 48px;
    }

    .card-panel-description {
      float: right;
      font-weight: bold;
      margin: 26px;
      margin-left: 0px;

      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }

      .card-panel-num {
        font-size: 20px;
      }
    }
  }
}

@media (max-width: 550px) {
  .card-panel-description {
    display: none;
  }

  .card-panel-icon-wrapper {
    float: none !important;
    width: 100%;
    height: 100%;
    margin: 0 !important;

    .svg-icon {
      display: block;
      margin: 14px auto !important;
      float: none !important;
    }
  }
}
</style>
